package detect.parse.tree;

import java.util.*;

import detect.parse.tree.token.PositionString;
import detect.parse.tree.token.TokenList;

public class ExpressionFactory {
//	public static final int RAW=0;
//	public static final int PLAIN=1;
//	public static final int FUN_CALL=2;
//	public static final int IF_ELSE=3;
//	public static final int IF=4;
//	public static final int ELSE=5;
//	public static final int WHILE=6;
//	public static final int FOR=7;
//	public static final int BLOCK=8;
	public static String IF_STR="if";	
	public static String ELSE_STR="else";
	public static String WHILE_STR="while";
	public static String FOR_STR="for";
	
	public static Expression expInstance=new Expression();
	public static ForExpression forExpInstance=new ForExpression();
	public static SwitchCaseExpression switchCaseExpInstance=new SwitchCaseExpression();
	public static CaseExpression caseExpInstance=new CaseExpression();	
	public static ConditionExpression condExpInstance=new ConditionExpression();
	public static FunctionCallExpression funCallExpInstance=new FunctionCallExpression();
	public static IfBranchExpression ifBranchExpInstance=new IfBranchExpression();
	public static IfElseExpression ifelseExpInstance=new IfElseExpression();
	public static DoWhileExpression doWhileExpInstance=new DoWhileExpression();
	public static WhileExpression whileExpInstance=new WhileExpression();
	public static BlockExpression blockExpInstance=new BlockExpression();
	
	public static int tempReturnCount=0;
	
	//public int VAR_
	public static List<Expression> parseBlock(PositionString block){
		return null;
	}	
	
	public static boolean isStartsWithReservedWord(String str){
		if(str.startsWith(IF_STR) || 
				str.startsWith(ELSE_STR) ||
				str.startsWith(WHILE_STR) ||
				str.startsWith(FOR_STR)){
			return true;
		}
		return false;
	}
	
	public static PositionString getNewTempReturnVariable(){
		String temp="tempReturnVar"+tempReturnCount;
		tempReturnCount++;		
		return new PositionString(temp,-1);
	}
}
